﻿namespace Raven
{
    public class Random
    {
        private System.Random _random;

        public Random(int seed)
        {
            _random = new System.Random(seed);
        }

        public Fix RandFix()
        {
            return new Fix(_random.Next(Fix.FractionRange));
        }

        public Fix RandomClamped()
        {
            return RandFix() - RandFix();
        }

        public int RandInt(int min, int max)
        {
            return _random.Next(min, max);
        }

        //returns a random bool
        public bool RandBool()
        {
            return RandFix() > Fix.Ratio(1, 2);
        }

        public Fix RandInRange(Fix x, Fix y)
        {
            return x + RandFix() * (y - x);
        }
    }
}